package com.bite.lesson3;

import java.util.Scanner;

public class Demo_02 {
    static volatile int flg = 0;

    public static void main(String[] args) {
        Thread thread01 = new Thread(() -> {
            System.out.println("线程01开始......");
            while (flg == 0) {

            }
            System.out.println("线程01结束......");
        });
        Scanner scanner = new Scanner(System.in);
        Thread thread02 = new Thread(() -> {
            flg = scanner.nextInt();
        });
        thread01.start();
        thread02.start();
    }
}
